import React from "react";
import Map from "@biz/Map";
import BaseModal from "@biz/BaseModal";
import LdhMap from "../../../../biz/LdhMap";

const prefix = "map-modal";
export default class UpdateMqttModal extends BaseModal {

    constructor(props) {
        super(props);
        this.visibleStatus = "map";
        this.title = "门店定位";
        this.className = prefix;
        this.width =1200;
        this.noOp = true;
        this.state = {
            pos:{}
        }
    }

    onVisible(nextProps){
        let {store} = nextProps;
        let {lat, lng} = store.detail;
        this.setState({pos:{lat,lng}});
    }


    onSubmit(values) {
        let {pos} = this.state;
        let {onSubmit} = this.props;
        onSubmit(pos);
        this.props.action.cancelModal();

    }
    onCancel(){
        let {action} = this.props;
        action.cancelModal();
    }
    handlePosChange(pos){
        this.setState({pos});
    }

    renderDetail() {
        let {pos} = this.state;
        return <div>
            <LdhMap onPosChange={this.handlePosChange.bind(this)} originPos={pos}/>
        </div>
    }

}